import Mock from "mockjs";
import { setStorage } from "../utils/storage";

const Random = Mock.Random;

// 设置默认数据
const listData = [];
for (var i = 0; i < 11; i++) {
  // 生成随机数据
  const item = Mock.mock({
    "id|+1": 1,
    titile: Random.string(),
  });
  listData.push(item);
}
console.log("生成的默认列表数据：", listData);
setStorage("listDb", listData);

// 生成用户数据
const users = Mock.mock({
  userId: Random.guid(), // 随机生成一个 GUID
  username: "@name", // 随机生成人名
});
console.log("生成的默认用户数据：", users);
const usersData = [users];
setStorage("userDb", usersData);
